package com.sk.bilibili.adapter.simple.member;

import static com.sk.bilibili.utils.StringUtils.str;

import android.content.Context;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.sk.bilibili.adapter.simple.BaseAdapter;
import com.sk.bilibili.bean.VideoSet;
import com.sk.bilibili.callBack.VideoSetCallBack;
import com.sk.bilibili.config.GlideApp;
import com.sk.bilibili.databinding.SearchVideoSetItemBinding;
import com.sk.bilibili.utils.TimeUtils;
import com.sk.bilibili.viewHolder.BaseViewHolder;

public class SearchAdapter extends BaseAdapter<SearchVideoSetItemBinding, VideoSet> {

    private VideoSetCallBack videoSetCallBack;

    public SearchAdapter(Context context,VideoSetCallBack videoSetCallBack) {
        super(context);
        this.videoSetCallBack=videoSetCallBack;
    }

    @Override
    protected void bindView(SearchVideoSetItemBinding bind, int position) {
        VideoSet videoSet = list.get(position);
        // bindView
        GlideApp.with(context).load(videoSet.getCover()).img().into(bind.ivShow);
//        bind.tvTitle.setText(videoSet.getTitle());
//        bind.tvDanmuNum.setText(str(videoSet.getDanmuNum()));
//        bind.tvPlayNum.setText(str(videoSet.getPlayNum()));
//        bind.tvTime.setText(TimeUtils.getShotTime(videoSet.getCreateDate()));
        // bindEvent
        bind.getRoot().setOnClickListener(v->videoSetCallBack.onClickVideoSet(videoSet.getId()));
    }

}